;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; plot surface pressure fields of the baroclinic wave test.
;;                                             2012/11/04 Daisuke Hotta

modelname="ref"
datadir="../../../../DATA/dyncore_barocl_"+modelname
outdir="../fig/"

;;
f=addfile("../data/eul_T340.ps.nc","r")
ps=f->PS(9,:,:)
ps=(/ps*0.01/)
delete(ps@units)
delete(ps@long_name)
;;;;;;;;;;;;;;;;;;;;;;;;;;; plot ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" 

wks=gsn_open_wks("pdf", outdir+"/ps_day9_"+modelname)
gsn_define_colormap(wks, "cosam12")

res=True
res@gsnMaximize=True
res@gsnDraw=False
res@gsnFrame=False

res@cnFillOn=True
res@gsnSpreadColors=True
res@cnLevelSelectionMode="ManualLevels"
res@cnMinLevelValF=930.
res@cnMaxLevelValF=1030
res@cnLevelSpacingF=10.
res@lbLabelAutoStride=True

minlon=45.
maxlon=365.
minlat=0.
maxlat=90.
width=0.8
res@vpWidthF=width
res@vpHeightF=((maxlat-minlat)/(maxlon-minlon))*width
res@tmXBMode="Manual"
res@tmXBTickStartF=minlon
res@tmXBTickEndF=maxlon
res@tmXBTickSpacingF=45.
res@tmYLMode="Manual"
res@tmYLTickStartF=minlat
res@tmYLTickEndF=maxlat
res@tmYLTickSpacingF=30

plot=gsn_csm_contour(wks, ps({0:90},{45:}), res)

txres                       = True
txres@txPerimOn             = True
txres@txBackgroundFillColor = "White"
txres@txFontHeightF         = 0.015
text=gsn_add_text(wks, plot, modelname, maxlon-20, maxlat-10 ,txres)
draw(plot)
frame(wks)
